package com.vimi8.ebb.model;


import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**

 * 政策法规

 * Created by jinlongG on 2016/7/7.

 */

public class PolicyRegulation implements Serializable {
    /*编号*/
    String id;
    /*推送人*/
    
    private String publisher;
    /*时间*/
    
    private Date createTime;
    /*来源*/
    
    private String source;
    /*标题*/
    
    private String title;
    /*内容摘要*/
    
    private String summary;
    /*文章内容*/
    
    private String content;
    /*图片*/
    
    private String picture;

    /*地址*/
    private String addressCode;

    public String getAddressCode() {
        return addressCode;
    }

    public void setAddressCode(String addressCode) {
        this.addressCode = addressCode;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public PolicyRegulation() {
    }

    public PolicyRegulation(String id, String publisher, Date createTime, String source, String title, String summary, String content, String picture) {
        this.id = id;
        this.publisher = publisher;
        this.createTime = createTime;
        this.source = source;
        this.title = title;
        this.summary = summary;
        this.content = content;
        this.picture = picture;
    }


    /**

     * 字符串转换成日期

     * @param str

     * @return date

     */
    public static Date StrToDate(String str) {

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = null;
        try {
            date = format.parse(str);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }


    public static List<PolicyRegulation> newBaseData() {
        List<PolicyRegulation> policyRegulationList = new ArrayList<>();
        return policyRegulationList;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PolicyRegulation that = (PolicyRegulation) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (publisher != null ? !publisher.equals(that.publisher) : that.publisher != null) return false;
        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
        if (source != null ? !source.equals(that.source) : that.source != null) return false;
        if (title != null ? !title.equals(that.title) : that.title != null) return false;
        if (summary != null ? !summary.equals(that.summary) : that.summary != null) return false;
        if (content != null ? !content.equals(that.content) : that.content != null) return false;
        return picture != null ? picture.equals(that.picture) : that.picture == null;

    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (publisher != null ? publisher.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (source != null ? source.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (summary != null ? summary.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (picture != null ? picture.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "PolicyRegulation{" +
                "id='" + id + '\'' +
                ", publisher='" + publisher + '\'' +
                ", createTime='" + createTime + '\'' +
                ", source='" + source + '\'' +
                ", title='" + title + '\'' +
                ", summary='" + summary + '\'' +
                ", content='" + content + '\'' +
                ", picture='" + picture + '\'' +
                '}';
    }
}